<?php

declare (strict_types=1);
/**
 * @copyright 深圳市易果网络科技有限公司
 * @version 1.0.0
 * @link https://dayiguo.com
 */

namespace App\Controller\agent;

use App\Kernel\Util\AgentJwtInstance;
use App\Middleware\User\AgentMiddleware;
use App\Service\Agent\ChannelService;
use Hyperf\Guzzle\ClientFactory;

use Hyperf\Di\Annotation\Inject;
use Hyperf\HttpServer\Annotation\AutoController;
use Hyperf\Snowflake\IdGeneratorInterface;
use Hyperf\HttpServer\Annotation\Middleware;

/**
 * 渠道商
 *
 * @AutoController()
 * @Middleware(AgentMiddleware::class)
 * @author 张昊(2396675557@qq.com)
 * @package App\Controller\admin
 */
class ChannelController extends Controller
{

    /**
     * @Inject
     * @var ChannelService
     */
    public $channel_service;

    /**
     * 渠道商列表
     */
    public function list()
    {
        $result = $this->channel_service->list();

        $this->success($result);
    }

    /**
     * 代理渠道商搜索
     */
    public function search()
    {
        $params = $this->request->all();
        $business_list = $this->channel_service->getChannelList($params);

        $this->success($business_list);
    }

    /**
     * 公司渠道商-公司直招的所有区
     */
    public function directDistricts()
    {
        $districts = $this->channel_service->getDirectDistricts();
        $this->success($districts);
    }

    /**
     * 公司渠道商-公司合伙人招的所有区
     */
    public function partnerDistricts()
    {
        $districts = $this->channel_service->getPartnerDistricts();
        $this->success($districts);
    }

    /**
     * 公司渠道商-搜索公司直招的区下面的渠道商
     */
    public function directSearch()
    {
        $params = $this->request->all();

        $channel_list = $this->channel_service->directChannelList($params);

        $this->success($channel_list);
    }

    /**
     * 公司渠道商-搜索公司市场合伙人下的区下面的渠道商
     */
    public function partnerChannelSearch()
    {
        $params = $this->request->all();

        $channel_list = $this->channel_service->partnerChannelList($params);

        $this->success($channel_list);
    }

    /**
     * 公司渠道商 - 公司直招区代下面的渠道商
     */
    public function companyChannel()
    {
        $result = $this->channel_service->companyChannel();

        $this->success($result);
    }

    /**
     * 合伙人渠道商 - 公司直招的合伙人招的区代下面的渠道商
     */
    public function partnerChannel()
    {
        $result = $this->channel_service->partnerChannel();

        $this->success($result);
    }

    /**
     * 合伙人直招区代下面的渠道商
     */
    public function getPartnerChannel()
    {
        $result = $this->channel_service->getPartnerChannel();

        $this->success( $result );
    }
}